<template>
	<view :style="themeColor" style="overflow-x: hidden;">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center inteGral_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub inteGral_fd0_0'>
					<view class='flex flex-wrap align-center inteGral_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<image class='inteGral_fd0_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"307.png"'></image>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='inteGral_fd0_0_c1_c0'>积分商城</text>
					</view>
					<view class='flex flex-wrap align-center inteGral_fd0_0_c0'>
					</view>
				</view>
			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---积分分类flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout inteGral_flex_1">
				<view class='flex flex-direction flex-wrap align-center inteGral_fd1_0'>
					<text class='inteGral_fd1_0_c1'>账户积分</text>
					<text class='inteGral_fd1_0_c0'>{{dataDetails.score||0}}</text>
					<view class='flex flex-wrap align-center justify-center inteGral_fd1_0_c2'  @tap.stop="handleJumpDiy" data-type="navigateTo" data-url="/pages/grzx/rulesExchange/rulesExchange">
						<text class='inteGral_fd1_0_c2_c0'>兑换规则</text>
					</view>
				</view>
			</view>

			<!---积分分类flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout inteGral_flex_2">
				<view class='flex flex-wrap align-center justify-between inteGral_fd2_0'
					style="font-family: Alimama DongFangDaKai;">
					<view class='flex flex-direction flex-wrap align-center' @tap.stop="handleJumpDiy"
						data-type="navigateTo" data-url="/pages/grzx/exChange/exChange">
						<image class='inteGral_fd2_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"584.png"'></image>
						<text class='inteGral_fd2_0_c0_c1'>兑换记录</text>
					</view>
					<view class='flex flex-direction flex-wrap align-center' @tap.stop="handleJumpDiy"
						data-type="navigateTo" data-url="/pages/grzx/inteDetails/inteDetails">
						<image class='inteGral_fd2_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"585.png"'></image>
						<text class='inteGral_fd2_0_c0_c1'>积分明细</text>
					</view>
					<view class='flex flex-direction flex-wrap align-center' @tap.stop="handleJumpDiy"
						data-type="navigateTo" data-url="/pages/sousuo/punchinTasks/punchinTasks">
						<image class='inteGral_fd2_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"586.png"'></image>
						<text class='inteGral_fd2_0_c0_c1'>去签到</text>
					</view>
				</view>
				<view class="duihuan_bg"></view>
				<view v-if="bobaoList.length" class='flex flex-wrap align-center inteGral_fd2_1'>
					
					<view style="position: relative">
						<swiper @change="bannerIndexfd2_1_c0 = $event.detail.current"
							class='flex position-relative inteGral_fd2_1_c0' previous-margin="0rpx" next-margin="0rpx"
							:display-multiple-items="1" :interval="5000" :duration="500" :autoplay='true'
							:circular='true'>


							<swiper-item v-for="item in bobaoList" :key="item.order_sn" class='flex  inteGral_fd2_1_c0'>
								<view class='flex align-center inteGral_fd2_1_c0_c1_c0'>
									<view class="inteGral_fd2_1_c0_c1_c0_c0">
										<image style="border-radius: 50%;width: 100%;height: 100%;" :src="item.head_img" mode="aspectFill"></image>
									</view>
									<view class="desc1_box">
										<text class='inteGral_fd2_1_c0_c1_c0_c1'>{{item.user_nickname}}</text>
										<text class='inteGral_fd2_1_c0_c1_c0_c1'>刚刚兑换了</text>
										<text class='inteGral_fd2_1_c0_c1_c0_c3'>{{item.goods_name}}</text>
										<text class='inteGral_fd2_1_c0_c1_c0_c1'>{{item.total_score}}积分</text>
									</view>
								</view>
							</swiper-item>
						</swiper>
					</view>
				</view>
				<view class='flex flex-direction flex-wrap align-stretch inteGral_fd2_2'>
					<view class='flex flex-wrap align-center inteGral_fd2_2_c0'
						style="font-family: Alimama DongFangDaKai;">
						<image class='inteGral_fd2_2_c0_c0' mode="aspectFill" :src='STATIC_URL+"604.png"'></image>
						<text class='inteGral_fd2_2_c0_c1'>积分兑换</text>
						<text class='inteGral_fd2_2_c0_c2'>小积分抽大奖</text>
					</view>
					<view class='flex flex-wrap align-center justify-between'>
						<view v-for="(item,i) in goodList" :key="i"
							:style="'animation-duration:'+item.animationTime+'s;'"
							class='animation-slide-right flex flex-direction flex-wrap align-stretch inteGral_fd2_2_c1_c0'
							@tap.stop="handleJumpDiy" data-type="navigateTo"
							:data-url="'/pages/grzx/commoDity/commoDity?id='+item.id">
							<image class='inteGral_fd2_2_c1_c0_c0' mode="aspectFit" :src='item.thumb'></image>
							<view class='flex flex-direction flex-wrap align-stretch inteGral_fd2_2_c1_c0_c1'>
								<text class='inteGral_fd2_2_c1_c0_c1_c0'>{{item.goods_name}}</text>
								<text class='inteGral_fd2_2_c1_c0_c1_c1'>¥{{item.shop_price}}</text>
								<view class='flex' style="align-items: baseline;">
									<text class='inteGral_fd2_2_c1_c0_c1_c2_c0'>{{item.score||0}}</text>
									<text class='inteGral_fd2_2_c1_c0_c1_c2_c1'>积分</text>
								</view>
							</view>
						</view>
					</view>

					<fu-empty v-if="goodListLoading"></fu-empty>
					<fu-empty-ui v-else-if="goodListEmpty"></fu-empty-ui>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<benben-popup v-model="popupShow1653901123045" :mask="true" :mask-close-able="true" mode='center'>
				<!---兑换规则flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center justify-center">
					<view class='flex flex-direction flex-wrap align-stretch inteGral_fd3_0'>
						<text class='inteGral_fd3_0_c0'>兑换规则</text>

						<scroll-view class='inteGral_fd3_0_c1' :scroll-y='true'>
							<view class='flex flex-direction align-stretch benben-scroll flex'>
								<jyf-parser class='inteGral_fd3_0_c1_c0' :html="dataEssay.content | richTextFormat">
								</jyf-parser>
							</view>
						</scroll-view>

					</view>
					<image class='inteGral_fd3_1' mode="aspectFit" :src='STATIC_URL+"190.png"'
						@tap.stop="popupShow1653901123045=false"></image>
				</view>

				<!---兑换规则flex布局结束-->

			</benben-popup>


		</view>
	</view>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"popupShow1653901123045": false,
				"bannerIndexfd2_1_c0": 0,
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"newslist": [{
						"name": "小油菜",
						"value": "",
						"image": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20220526/10daa2765308794f99b8f2fcaa185ddc.png"
					}, {
						"name": "酱香猪蹄",
						"value": "",
						"image": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20220528/d2b2b7287ff3282502a8b9789a3948c4.png"
					},
					{
						"name": "菊花",
						"value": "",
						"image": "https://zhongben-crm.oss-cn-zhangjiakou.aliyuncs.com/uploads/images/20220528/d15cbfa4d75281385ef73f7dd01a8acc.png"
					}
				],
				"commoditype": "1",
				"dataList": [],
				"dataMessage": [],
				"index": 1,
				"dataDetails": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"hobby": "",
					"tags": "",
					"id": "",
					"userlevel_id": "",
					"mobile": "",
					"real_name": "",
					"avatar": "",
					"account": "",
					"email": "",
					"birthday": "",
					"gender": "",
					"create_time": "",
					"user_money": "",
					"freeze_money": "",
					"total_consumption_money": "",
					"score": "",
					"_mobile": "",
					"coupon": "",
					"collection_count": "",
					"browse_count": "",
					"total_money": "",
					"certified": "",
					"nickname": "",
					"is_pay_password": "",
					"follow_count": ""
				},
				"dataEssay": {
					"content": ""
				},
				bobaoList: [],
				goodList: [],
				goodListPage: 1,
				goodListTotal: 0,
				goodListAfresh: false,
				goodListLoading: true,
				goodListEmpty: false,
				goodListRequestStart: false, // 请求开始
				goodListResetTimer: null,
			};
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo
			},
			themeColor() {
				return this.$store.getters.themeColor
			},
			isLogin() {
				return this.$store.state.token == '' ? false : true;
			}
		},
		onShow() {
			this.getOrderBobao();
			this.getUserinfoFunc();
		},
		onPullDownRefresh() {
			this.resetgoodList();
		},
		onReachBottom() {
			this.goodListLoading && this.getgoodList();
		},
		onLoad() {
			this.getgoodList();
		},
		methods: {
			/** 重新获取积分商品列表 */
			resetgoodList() {
				this.goodListAfresh = true;
				this.goodListLoading = true;
				this.goodListEmpty = false;
				this.goodListRequestStart = false;
				clearTimeout(this.goodListResetTimer);
				this.goodListResetTimer = setTimeout(() => this.getgoodList(), 300);
			},
			/** 获取积分商品列表执行 */
			async getgoodList() {
				if (this.goodListRequestStart) return;
				this.goodListRequestStart = true;
				if (this.goodListAfresh) this.goodListPage = 1;
				try {
					var res = await this.$post('6555fe6629bd1', {
						page: this.goodListPage,
						list_rows: 10,
						// 其他参数
					});
					const _goodList = (res.data.data || []).map((t, i) => {
						return {
							...t,
							animationTime: i / 10 + 0.25
						}
					})
					if (this.goodListAfresh) this.goodList = _goodList;
					else this.goodList = this.goodList.concat(_goodList);
					this.goodListPage++;
					this.goodListTotal = res.data.total;
					this.goodListLoading = this.goodList.length < this.goodListTotal;
				} catch (e) {
					this.goodListLoading = false;
				}
				this.goodListAfresh = false;
				uni.stopPullDownRefresh();
				this.goodListRequestStart = false;
				this.goodListEmpty = !this.goodList.length && !this.goodListLoading;
			},
			// 获取订单播报
			async getOrderBobao() {
				try {
					const res = await this.$post('6556191dae32c', {});
					this.bobaoList = res.data || [];
				} catch (e) {
					this.$msg((e || {}).msg || "失败")
				}
			},
			//获取个人信息
			async getUserinfoFunc() {
				let datadataDetails = await this.$api.get(global.apiUrls.post5c78c4772da97, {
				
				});
				
				if (datadataDetails.data.code != 1) {
					this.$message.info(datadataDetails.data.msg);
					return
				}
				let infodataDetails = datadataDetails.data;
				this.dataDetails = infodataDetails.data
			},
			//积分商城-积分商品列表
			getListFunc() {
				this.minixPagingListsApi = global.apiUrls.post641457e74fa3e;
				this.pageingListApiMethod = 'get';
				this.allowOnloadGetList = false;
				this.pagingListPostDataContent = {}
				this.listData = [];
				this.dataList = this.listData;
				this.pagingListToggle();
			},
			//积分商城-兑换规则
			async getRuleFunc() {
				//请求方法
				//数据验证

				let datadataEssay = await this.$api.post(global.apiUrls.post64156a0fd7451, {

				});

				if (datadataEssay.data.code != 1) {
					this.$message.info(datadataEssay.data.msg);
					return
				}
				let infodataEssay = datadataEssay.data;
				this.dataEssay = infodataEssay.data
			},
			//积分商城-滚动兑换人员信息
			async getTypeFunc() {
				//请求方法
				//数据验证

				let datadataMessage = await this.$api.post(global.apiUrls.post64156140edd5a, {

				});

				if (datadataMessage.data.code != 1) {
					this.$message.info(datadataMessage.data.msg);
					return
				}
				let infodataMessage = datadataMessage.data;
				this.dataMessage = infodataMessage.data
			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.duihuan_bg {
		width: 100%;
		height: 50rpx;
		border-radius: 40rpx 40rpx 0 0;
		transform: translateY(-60rpx);
		background-color: #f8f8f8;
	}
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(https://yongzhixing.niurenjianzhan.com/uploads/mini/583.png) no-repeat;
		background-size: 100% auto;
	}

	.inteGral_flex_0 {
		background: url(https://yongzhixing.niurenjianzhan.com/uploads/mini/583.png) no-repeat;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.inteGral_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 88rpx;
	}

	.inteGral_fd0_0_c0_c0 {
		width: 20rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.inteGral_fd0_0_c0 {
		width: 130rpx;
	}

	.inteGral_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.inteGral_flex_1 {
		padding: 0rpx 0rpx 0rpx 0rpx;
	}

	.inteGral_fd1_0_c2_c0 {
		color: #F35D2A;
		font-weight: 400;
		font-size: 24rpx;
		// padding: 10rpx 19rpx 10rpx 19rpx;
	}

	.inteGral_fd1_0_c2 {
		background: #FFFFFF;
		height: 48rpx;
		line-height: 48rpx;
		text-align: center;
		background-size: 100% auto;
		border-radius: 100rpx 0rpx 0rpx 100rpx;
		position: absolute;
		right: 0rpx;
		width: 136rpx;
		top: 42rpx;
	}

	.inteGral_fd1_0_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #FFFFFF;
		margin-bottom: 12rpx;
	}

	.inteGral_fd1_0_c0 {
		font-size: 80rpx;
		font-weight: 600;
		color: #FFFFFF;
		// margin: 0rpx 0rpx 12rpx 0rpx;
	}

	.inteGral_fd1_0 {
		padding: 48rpx 24rpx 43rpx 24rpx;
		position: relative;
		margin: 0rpx 0rpx 0rpx 0rpx;
	}

	.inteGral_flex_2 {
		margin: 0rpx 0rpx 0rpx 0rpx;
	}

	.inteGral_fd2_2_c1_c0_c1_c2_c1 {
		color: #FC3045;
		font-size: 20rpx;
		font-weight: 600;
		margin-left: 4rpx;
	}

	.inteGral_fd2_2_c1_c0_c1_c2_c0 {
		color: #FC3045;
		font-size: 36rpx;
		font-weight: 500;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		max-width: 100rpx;
	}

	.inteGral_fd2_2_c1_c0_c1_c1 {
		color: #333;
		font-size: 26rpx;
		font-weight: 700;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		max-width: 120rpx;
		margin: 18rpx 0rpx 20rpx 0rpx;
	}

	.inteGral_fd2_2_c1_c0_c1_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		max-width: 260rpx;
	}

	.inteGral_fd2_2_c1_c0_c1 {
		padding: 25rpx 0rpx 25rpx 20rpx;
	}

	.inteGral_fd2_2_c1_c0_c0 {
		width: 334rpx;
		height: 346rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
	}

	.inteGral_fd2_2_c1_c0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		overflow: hidden;
	}

	.inteGral_fd2_2_c0_c2 {
		color: #999999;
		font-size: 26rpx;
		font-weight: 400;
	}

	.inteGral_fd2_2_c0_c1 {
		color: #333333;
		font-size: 34rpx;
		font-weight: 500;
		margin: 0rpx 24rpx 0rpx 16rpx;
	}

	.inteGral_fd2_2_c0_c0 {
		width: 7rpx;
		height: 30rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.inteGral_fd2_2_c0 {
		margin: 0rpx 0rpx 38rpx 0rpx;
	}

	.inteGral_fd2_2 {
		margin: 0rpx 0rpx 0rpx 0rpx;
		padding: 0 32rpx 24rpx;
		// border-radius: 40rpx 40rpx 0 0;
	}

	.inteGral_numberfd2_1_c0_c0 {
		background: #525050;
		position: absolute;
		bottom: 20rpx;
		right: 30rpx;
		width: 80rpx;
		height: 40rpx;
		border-radius: 6rpx 6rpx 6rpx 6rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 46rpx;
		font-weight: 400;
	}

	.inteGral_fd2_1_c0_c1_c0_c3 {
		color: #F35D2A;
		font-size: 28rpx;
		font-weight: 400;
	}

	.inteGral_fd2_1_c0_c1_c0_c1 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
	}

	.inteGral_fd2_1_c0_c1_c0_c0 {
		width: 48rpx;
		height: 48rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 24rpx 0rpx 24rpx;
	}

	.inteGral_fd2_1_c0_c1_c0 {
		width: 750rpx;
		height: 80rpx;
		border-radius: 10rpx;
	}

	.inteGral_fd2_1_c0 {
		width: 750rpx;
		height: 80rpx;
	}

	.inteGral_swiperDotUnselectedfd2_1_c0 {
		border: 1px solid rgba(0, 0, 0, 0.3);
		background: rgba(0, 0, 0, 0.3);
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	.inteGral_swiperDotSelectedfd2_1_c0 {
		border: 1px solid #00A7FF;
		background: #00A7FF;
		width: 16rpx;
		height: 16rpx;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		margin: 0rpx 6rpx 0rpx 0rpx;
		font-size: 24rpx;
		color: #fff;
	}

	::v-deep .inteGral_swiperDotfd2_1_c0 {
		position: absolute;
		bottom: 20rpx;
		left: 0rpx;
		right: 0rpx;
	}

	.inteGral_fd2_1 {
		background: #FFEDE6;
		width: 750rpx;
		height: 80rpx;
		// margin: 20rpx 0 0;
		transform: translateY(-28rpx);
	}

	.inteGral_fd2_0_c0_c1 {
		margin: 13rpx 0rpx 0rpx 0rpx;
		color: #323232;
		font-size: 28rpx;
		font-weight: 400;
	}

	.inteGral_fd2_0_c0_c0 {
		width: 64rpx;
		height: 64rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.inteGral_fd2_0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		width: 702rpx;
		height: 157rpx;
		padding: 0rpx 52rpx 0rpx 71rpx;
		margin: 0 24rpx;
		position: relative;
		z-index: 10;
	}

	.inteGral_fd3_1 {
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		width: 56rpx;
		height: 56rpx;
		margin: 48rpx 0rpx 0rpx 0rpx;
	}

	::v-deep .inteGral_fd3_0_c1_c0 {
		width: 100%;
	}

	.inteGral_fd3_0_c1 {
		touch-action: none;
		width: 470rpx;
		height: 300rpx;
	}

	.inteGral_fd3_0_c0 {
		font-size: 36rpx;
		font-weight: 800;
		color: rgba(51, 51, 51, 1);
		text-align: center;
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.inteGral_fd3_0 {
		background: #fff;
		border-radius: 25rpx 25rpx 25rpx 25rpx;
		padding: 40rpx 32rpx 44rpx 32rpx;
		width: 540rpx;
	}

	.desc1_box {
		width: 630rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
</style>